<?php
namespace Cyfy\Modules\FileManager\Forms;

use \Cyfy\Message;
use \Cyfy\Modules\Forms;
/**
 * Uploads new files into FILE_DIR
 */
class Upload extends Forms\Form{

	function structure()
	{		
        $this -> permission("FileManager", "use");
        $this -> stay = false; 
        
		$i = new Forms\File("files", self :: t(310), \Cyfy\Cyfy :: $filesDir);
        $i -> appendDirnameFromInput("directory");
        $i -> minFiles = 1;
        $i -> maxFiles = 80;
        $this -> addItem($i);
        
		$i = new Forms\Hidden("directory", "");
        $i -> setId("fileUploadFormDirectory");
		$this -> addItem($i);
		
		$b = new Forms\Button(self :: t(320), Forms\Button::OK);
		$this -> addButton($b);
    }
    
	function submit()
	{  
        $this -> onSubmit = "fileManager.readDir('" . $this -> get("directory") . "', true); $('.fileUploadFormC').slideUp();";
		\Cyfy\Message :: set(self :: t(330));
        return true;
	}	

}